UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QGBa7ZxY82m1sIbHJymgH2AOzpoUjJ+27gkieDVoIbU=' 
WHERE 
  key_id = '4f2078d7491609513473d0354c525cd9a6ce4748da3e22d593145f823b9180b7' 
  AND (
    token = 'QGBa7ZxY82m1sIbHJymgH2AOzpoUjJ+27gkieDVoIbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071