UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'naJgRcop30PUeBKFHdKWyFKu74WbTzRlwimMutIRbHM='
WHERE
key_id = '8170883c781241fb4038e8b80cfa830aec4c7a73354991d4786550b25d3b2aa0'
AND (
token = 'naJgRcop30PUeBKFHdKWyFKu74WbTzRlwimMutIRbHM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)