UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sSHEj3BuQc7msc08Pgz7tbFWp6lHv9AOlHlxfpnzkKw=' 
WHERE 
  key_id = '4d8435f8ba02b0f8bd3db12c0bb80e3002046417a479b42102707aa2b6e71714' 
  AND (
    token = 'sSHEj3BuQc7msc08Pgz7tbFWp6lHv9AOlHlxfpnzkKw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045