UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wAAYnqdHaV9EPabGkMZDF35mh6l3tWKSribGbX93AAs=' 
WHERE 
  key_id = '79861fe9b2a093debcec802677c67f33f20fb358002016a631861759c07b3f38' 
  AND (
    token = 'wAAYnqdHaV9EPabGkMZDF35mh6l3tWKSribGbX93AAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033