UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7PMGfBM41YAAqIJHXgiZlRX0meNLQSVO3JjQeTa8eXo='
WHERE
key_id = 'af8c13986c600526c0ba8d6dc60581a0e7967bda50fc3aaf12c26d14b2c4f66d'
AND (
token = '7PMGfBM41YAAqIJHXgiZlRX0meNLQSVO3JjQeTa8eXo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)