UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gxp4Bl1jr42egS8hkCM2+QtOd8ZWLE8OQ4UkxlD5MXY=' 
WHERE 
  key_id = '082f73995f3ce1db3c31539ec2d19d7d97c590eb952d73861897697913650e27' 
  AND (
    token = 'gxp4Bl1jr42egS8hkCM2+QtOd8ZWLE8OQ4UkxlD5MXY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026