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