UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mas+U/NCFJ1t/8fbykBCYQDyQjy360itXgGc3Af83MY=' 
WHERE 
  key_id = 'f43daeca806927413785d88b53699e661231c0d8763634d40c8cab58f35694e1' 
  AND (
    token = 'Mas+U/NCFJ1t/8fbykBCYQDyQjy360itXgGc3Af83MY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020