UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LnRMv7CY/0eENgDZeN0bTw8qyZHCOWQLyZrBNhSMWE4='
WHERE
key_id = 'd514000a24bf4129b6aff3bed480392eeac44a04922fa245b6eb2bb0ba2b5558'
AND (
token = 'LnRMv7CY/0eENgDZeN0bTw8qyZHCOWQLyZrBNhSMWE4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)