UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wkop1ivzyFy3KCPiYW4yjjiTCdeaXarEJ41XqHgC0cg='
WHERE
key_id = '21c46c68b29112135505a5b7c7c9433938d3ece37ad172f3f3de4293a6c8fd38'
AND (
token = 'wkop1ivzyFy3KCPiYW4yjjiTCdeaXarEJ41XqHgC0cg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)