UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GYe7PdNRr7qDoAhizHc1NOB6UbJLIi3ajvAYmxzY2Og=' 
WHERE 
  key_id = '5a94ab7b1512675814b2ac60624b831dc373638fe1a8771931516547b38577ef' 
  AND (
    token = 'GYe7PdNRr7qDoAhizHc1NOB6UbJLIi3ajvAYmxzY2Og=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028