UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+sSQWsg2Is+0SmiJcs8DjvdOvb/G/ApUyCJOAfK4Qrc=' 
WHERE 
  key_id = 'b2f4815efad05a4a6eccf35cc52da7ffbb3ab921bacaf31117526f762d68760f' 
  AND (
    token = '+sSQWsg2Is+0SmiJcs8DjvdOvb/G/ApUyCJOAfK4Qrc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016