UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gyso+q8pOaNIXznnHhAJU/0133LJd3+juZP2/EY9IbA=' 
WHERE 
  key_id = '9db19991df282b80c34dcb108ca46fafa39d7be5b487963ca468cb053fae5d5a' 
  AND (
    token = 'gyso+q8pOaNIXznnHhAJU/0133LJd3+juZP2/EY9IbA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00268