UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XpyCqFoz2oemGoXu+VyFgFVBCTUAkhfgj19RrEk59uU=' 
WHERE 
  key_id = 'dd5103840ab9fb0de8219d27dd4435b41fc080a611876b1903c4b1cfcd479849' 
  AND (
    token = 'XpyCqFoz2oemGoXu+VyFgFVBCTUAkhfgj19RrEk59uU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031