UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KDUI1KHcIQyG8VoITkzZtZZ8rbAEc7aXxHe6v2d+wNU='
WHERE
key_id = 'd4515d9b526d42bae62ef4be117f9b7ab0b8a75ca7abb5287a61bb0e78f00d79'
AND (
token = 'KDUI1KHcIQyG8VoITkzZtZZ8rbAEc7aXxHe6v2d+wNU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)