UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9yBWnKOHhEqHjoHiEucqHmKa/BqvHi++xQTrzGv1UKw=' 
WHERE 
  key_id = '5129130b36e935b131efe775b0ff5bfb21e5cb96448b7e9f8bd444e75099d309' 
  AND (
    token = '9yBWnKOHhEqHjoHiEucqHmKa/BqvHi++xQTrzGv1UKw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037