UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PmhnQFP2uHl/9IlXx8VQfmNjKsr94O1nMHk7oTX83wE='
WHERE
key_id = 'e04a35a7fd5f16a79363213a57bc8afe898f0e9012a6826e85946833cf1d6a8e'
AND (
token = 'PmhnQFP2uHl/9IlXx8VQfmNjKsr94O1nMHk7oTX83wE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)