UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QglYyVOhnCnXS01dtdiLaQSXd8PTVmBQE3tMFHizZX4='
WHERE
key_id = '9f05ef006a84a8eef30786c8727306becdca35854808c46f9a61889c0252d86b'
AND (
token = 'QglYyVOhnCnXS01dtdiLaQSXd8PTVmBQE3tMFHizZX4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)