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