UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bPv8Qd8SN8eAqvWmfjyUrgLTXRJoWSC5vkpFczk7HHM='
WHERE
key_id = 'a5eeaa90e9b81ccce0b8901158cfb86633cede183e35cb04861ba0d470ab5302'
AND (
token = 'bPv8Qd8SN8eAqvWmfjyUrgLTXRJoWSC5vkpFczk7HHM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)