UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aquF+675HxDrjhzGgivqWOBLvpylDkpWw0WHg6Pu23Y='
WHERE
key_id = '9c0d317b58b8abadf686f8e8470c5fac215ac5340a85386681d6b91e5fadfb9a'
AND (
token = 'aquF+675HxDrjhzGgivqWOBLvpylDkpWw0WHg6Pu23Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)