UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rlx9DWGTtBgwLsXsFJplhcLTUT3bCx+GaD12gWTM/Cg=' 
WHERE 
  key_id = '1646b7debed709765458c3f6ba24bcbcd3ba034140f1dd2ffd81dbc0d5faac67' 
  AND (
    token = 'rlx9DWGTtBgwLsXsFJplhcLTUT3bCx+GaD12gWTM/Cg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029