UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QjPrk9hiNoulVKzh4PUTgtHlD//FTzBl1x+2AJm+SR0=' 
WHERE 
  key_id = '0d3651e28131a0e5bededf003219753483813db88908ba506096ab596f85fcdb' 
  AND (
    token = 'QjPrk9hiNoulVKzh4PUTgtHlD//FTzBl1x+2AJm+SR0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036