UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'USFmZhrzaPlErLNiIdE9akOfa7zfHu7egW0NLWMmF5g='
WHERE
key_id = 'cc7e6049dc56f896c49b51f44f4f771f01a066b91e73bc17e5aa1c0d2ca6a683'
AND (
token = 'USFmZhrzaPlErLNiIdE9akOfa7zfHu7egW0NLWMmF5g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)