UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7VppAVYoMy83Voey8VmdtuR/mJ5XKqiY5gYQx+kZ9U4='
WHERE
key_id = '3f780bb318fb0469e92676947147321c6d3db7f9b42802512b7a7a700b6dd960'
AND (
token = '7VppAVYoMy83Voey8VmdtuR/mJ5XKqiY5gYQx+kZ9U4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)