UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CQYFia2zi8ondyRAIbZKRQzoH1b2i1oqTzP/CGvry1g='
WHERE
key_id = 'ebe532dc2ef352fb5a45fa82d0148be4636b9be5cad428379a1c826d51846fc2'
AND (
token = 'CQYFia2zi8ondyRAIbZKRQzoH1b2i1oqTzP/CGvry1g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)