UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0yQmzzPbGeXYCtNFVkMQaEvEXwA9RFMHE1CUCfgXdc4='
WHERE
key_id = 'cbd13fa5369d536e59af71a4d60bc6e8c856563fc64c228c634745b31d537dde'
AND (
token = '0yQmzzPbGeXYCtNFVkMQaEvEXwA9RFMHE1CUCfgXdc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)