UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QfvwU2x7nevx14PSbf6sz8Vf3XZO0HuAIxItiktIQic=' 
WHERE 
  key_id = '7616afb2c2b00f9280786fb5d0891ef8fb89195becdf164f449ad3dd0e0c283e' 
  AND (
    token = 'QfvwU2x7nevx14PSbf6sz8Vf3XZO0HuAIxItiktIQic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038