UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9sA3aKSrTqtd7SKeMWBblqND4z8GzFhXuhzNy5oYLWI='
WHERE
key_id = '4044c77672d1fc434808938ba6b98e4097c8e9fbc791c9dde5730171fbe13c64'
AND (
token = '9sA3aKSrTqtd7SKeMWBblqND4z8GzFhXuhzNy5oYLWI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)