UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ERNAk4mBij0vziRd/Hf4BvfX4zJsD/qKfAvPme5mQMw='
WHERE
key_id = 'bd34abf30b27c95a666d0789b75f23517cc38bcc7a44b35bf9b2c68f44a24152'
AND (
token = 'ERNAk4mBij0vziRd/Hf4BvfX4zJsD/qKfAvPme5mQMw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)