UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tdCMWucK9fl4sCSKaRnYqsdWcZ14gkhBCpQiP2Wp4dk=' 
WHERE 
  key_id = 'f12c8cf38a34693f25ea54103e1eb907bcb819d97443f1e8ae15bfe377baa30a' 
  AND (
    token = 'tdCMWucK9fl4sCSKaRnYqsdWcZ14gkhBCpQiP2Wp4dk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049