UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o7uSA0hEMC5B++VfycHvKavzybyWmUVGsD+ATpsXyQg=' 
WHERE 
  key_id = '3c41dfaa9f2d94ddf7ec13aea18989129bd30b06c1a17838650c88ee9bddbbb3' 
  AND (
    token = 'o7uSA0hEMC5B++VfycHvKavzybyWmUVGsD+ATpsXyQg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00089