UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f/roq/jd122l/W4N5J5IW8SoayAiZAl08iRYZvzsg/w=' 
WHERE 
  key_id = '522eaa640c014d50d94e82ed1fe845973533a9de0103c693d382daf945f08519' 
  AND (
    token = 'f/roq/jd122l/W4N5J5IW8SoayAiZAl08iRYZvzsg/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029