UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q697vtB/kzRt7iEoKXT3ioEyLBwSvLxHKgP1roxQK+U='
WHERE
key_id = '67644c4aa06ce36455997dbcc01cc0fcdd150bad7223b8d6b8703aa23451e607'
AND (
token = 'q697vtB/kzRt7iEoKXT3ioEyLBwSvLxHKgP1roxQK+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)