UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9jzqXebe1vWEZSTiMFDK5zWqTxv7ImIbdDsZgkMpVoE='
WHERE
key_id = '4cc9d494ceb0e498acc43255fb301b53e34e4705d2652c781752e04298300824'
AND (
token = '9jzqXebe1vWEZSTiMFDK5zWqTxv7ImIbdDsZgkMpVoE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)