UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8aLqtRvQoBVBO0so3NDPWbEy5vWg0M0cyWE1UW4ls68=' 
WHERE 
  key_id = 'a0a6807b87d6148da7003af14558e94e37affffb34db18536e4f5646e79ed743' 
  AND (
    token = '8aLqtRvQoBVBO0so3NDPWbEy5vWg0M0cyWE1UW4ls68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023