UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6xEax89mYz+gqHJC81NGwa34DJHVau4IsbcDNOXqZzc=' 
WHERE 
  key_id = '37fbb7bd1da16a6ea3d530ec415faaec977d9fa16cfaf051bb8696cf9c0158f7' 
  AND (
    token = '6xEax89mYz+gqHJC81NGwa34DJHVau4IsbcDNOXqZzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030