UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tmO3YNczoG7zlDbh2ZS/T98kP6mKZoFiIogx+enwS10=' 
WHERE 
  key_id = 'df634213b098d156f413948c821e4531270c5b517a3d1e524cb30fba1205bfd1' 
  AND (
    token = 'tmO3YNczoG7zlDbh2ZS/T98kP6mKZoFiIogx+enwS10=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058