UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KTasaHTmWVy7vaVNGVnv/MC/2dLsB+f77SpWHnMtVvA=' 
WHERE 
  key_id = '47edc1456e7830d981d9b30a740a342c103009be117ba015b8c48b7e79048d45' 
  AND (
    token = 'KTasaHTmWVy7vaVNGVnv/MC/2dLsB+f77SpWHnMtVvA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032