UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LM6Wa1Fy6v3LG6SOpIqhUOxvs+e92YO88zj+yUhO7MM=' 
WHERE 
  key_id = '98f451b7b558d094becc9869dbccadeffdedc8662fb05da6d338e7c2003858fc' 
  AND (
    token = 'LM6Wa1Fy6v3LG6SOpIqhUOxvs+e92YO88zj+yUhO7MM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032